//
//  DDLoginView.m
//  ialone
//
//  Created by lanou on 16/1/11.
//  Copyright © 2016年 JasperSong. All rights reserved.
//

#import "DDLoginView.h"
#import <QuartzCore/QuartzCore.h>
@implementation DDLoginView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self) {
        [self addSubviews];
    }
    
    return self;
}

- (void)addSubviews
{
    // 找回密码
    self.findPasswordButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.findPasswordButton.frame = CGRectMake(kScreenWidth - 80 - 20, 30, 80, 25);
    self.findPasswordButton.backgroundColor = [UIColor whiteColor];
    self.findPasswordButton.titleLabel.font = [UIFont systemFontOfSize:13];
    [self addSubview:self.findPasswordButton];
    
    // 输入手机号
    self.phoneNumberTF = [[UITextField alloc] initWithFrame:CGRectMake(20, self.findPasswordButton.frame.origin.y + self.findPasswordButton.frame.size.height + 10, kScreenWidth - 20 * 2, 50)];
    self.phoneNumberTF.backgroundColor = [UIColor whiteColor];
    self.phoneNumberTF.borderStyle = UITextBorderStyleLine;
    
    // 改变文本框得边框颜色
    self.phoneNumberTF.layer.borderWidth= 1.0f;
    self.phoneNumberTF.layer.borderColor = [UIColor brownColor].CGColor;
    
    self.phoneNumberTF.placeholder = @" 账号";
    self.phoneNumberTF.tag = 1001;
    [self addSubview:self.phoneNumberTF];
    
    // 输入密码
    self.passwordTF = [[UITextField alloc] initWithFrame:CGRectMake(self.phoneNumberTF.frame.origin.x,self.phoneNumberTF.frame.origin.y + self.phoneNumberTF.frame.size.height + 10, self.phoneNumberTF.frame.size.width,self.phoneNumberTF.frame.size.height)];
   self.passwordTF.borderStyle = UITextBorderStyleLine;
     self.passwordTF.layer.borderWidth= 1.0f;
    self.passwordTF.layer.borderColor = [UIColor brownColor].CGColor;
    self.passwordTF.backgroundColor = [UIColor whiteColor];
    self.passwordTF.placeholder = @" 密码";
    self.passwordTF.tag = 1002;
    [self addSubview:self.passwordTF];
    
    // 登录
    self.loginButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.loginButton.frame =CGRectMake(self.passwordTF.frame.origin.x,self.passwordTF.frame.origin.y + self.passwordTF.frame.size.height + 10, self.passwordTF.frame.size.width,self.passwordTF.frame.size.height);
    self.loginButton.backgroundColor = [UIColor brownColor];
    [self addSubview:self.loginButton];
    
    // 新浪登录
    self.sinaLoginButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.sinaLoginButton.frame =CGRectMake(kScreenWidth / 2 - 20 - 60, self.loginButton.frame.origin.y + self.loginButton.frame.size.height + 30, 60,60);
    self.sinaLoginButton.layer.cornerRadius = 30;
    self.sinaLoginButton.layer.masksToBounds = YES;
    [self.sinaLoginButton setBackgroundImage:[UIImage imageNamed:@"weibo"] forState:UIControlStateNormal];
    [self addSubview:self.sinaLoginButton];
    
    // 分割线
    self.lineImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth / 2, self.sinaLoginButton.frame.origin.y, 1, self.sinaLoginButton.frame.size.height)];
    self.lineImageView.backgroundColor = [UIColor blackColor];
    [self addSubview:self.lineImageView];
    
    
    // 微信登录
    self.weiXinLoginButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    self.weiXinLoginButton.frame =CGRectMake(kScreenWidth / 2 + 20 , self.sinaLoginButton.frame.origin.y, self.sinaLoginButton.frame.size.width, self.sinaLoginButton.frame.size.height);
    self.weiXinLoginButton.layer.cornerRadius = 30;
    self.weiXinLoginButton.layer.masksToBounds = YES;
    [self.weiXinLoginButton setBackgroundImage:[UIImage imageNamed:@"QQ"] forState:UIControlStateNormal];
    [self addSubview:self.weiXinLoginButton];
    
    
    self.tishi = [[UILabel alloc]initWithFrame:CGRectMake((kScreenWidth-130)/2,self.weiXinLoginButton.bottom + 10 ,130 ,50 )];
    self.tishi.textColor = [UIColor brownColor];
    self.tishi.text = @"第  三  方  登  陆";
    [self addSubview:self.tishi];
    
    

}












/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
